
<style>
    #user-password-update{
        padding: 10px 15px;
    }
    #user-password-update .tips {
        margin-bottom: 30px;
    }
    #user-password-update .layui-form input, #user-password-update .layui-form textarea{
        width: 60%;
        height: 32px;
        border-radius: 5px;
    }
    #user-password-update .layui-input-block{
        margin: 10px 0!important;
    }

    #user-password-update .layui-form-item{
        margin-bottom: 25px;
    }
    #user-password-update .layui-ebe-btn{
        padding: 15px 0;
    }
    #user-password-update .layui-input:focus{
        box-shadow: 0 0 0 2px rgba(0, 150, 136, 0.2);
    }
    #user-password-update .ebe-layer-btn{
        height: 32px;
        line-height: 32px;
    }
</style>
<div id="user-password-update">
    <div class="tips">
        <p>密码长度最少6个字符。</p>
        <p>为了您的用户安全，请注意保密。</p>
    </div>
    <form action="" class="layui-form" lay-filter="user-update-password">

        <div class="layui-form-item">
            <label >原密码：</label>
            <div class="layui-input-block">
                <input type="password" name="oldPassword" minlength="6" maxlength="18"
                       lay-verify="required|range"  placeholder="请输入原密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label >新密码：</label>
            <div class="layui-input-block">
                <input type="password" name="newPassword" minlength="6" maxlength="18"
                       lay-verify="required|range"  placeholder="请输入新密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label >密码确定：</label>
            <div class="layui-input-block">
                <input type="password" name="passwordEnsure" minlength="6" maxlength="18"
                       lay-verify="required|range"  placeholder="请再次输入新密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-ebe-btn">
            <button class="layui-btn ebe-layer-btn" lay-submit="" lay-filter="user-update-password-submit" id="submit">提交</button>
            <button type="reset" class="layui-btn ebe-layer-btn layui-btn-primary">重置</button>
        </div>
    </form>
</div>
<script data-th-inline="none" type="text/javascript">
    layui.use(['jquery', 'form', 'layuimini','validate','layer'], function () {
        var $ = layui.jquery,
            form = layui.form,
            layuimini = layui.layuimini,
            validate = layui.validate,
            $view = $("#user-password-update");


        form.verify(validate);
        form.render();


        form.on('submit(user-update-password-submit)', function (data) {
            var params = data.field;
            if (params.newPassword !== params.passwordEnsure) {
                layuimini.alert.warn("两次密码不一致");
                return false;
            }
            layuimini.put("/system-user/password/update",data.field, function () {
                layuimini.alert.success("修改密码成功");
            });
            return false;
        });



    })
</script>